package com.blueheart.easyexcel.user;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.CellExtra;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.read.listener.ReadListener;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;


@Slf4j
public class UserInfoReadListener implements ReadListener<UserInfoVO> {

    private final List<UserInfoVO> users;

    public UserInfoReadListener(final List<UserInfoVO> users){
        this.users = users;
    }



    @Override public void onException(final Exception exception, final AnalysisContext context) throws Exception {

    }

    @Override public void invokeHead(final Map<Integer, ReadCellData<?>> headMap, final AnalysisContext context) {

    }

    @Override public void invoke(final UserInfoVO data, final AnalysisContext context) {
//        log.info(data.toString());
        users.add(data);
    }

    @Override public void extra(final CellExtra extra, final AnalysisContext context) {

    }

    @Override public void doAfterAllAnalysed(final AnalysisContext context) {

    }


}
